package com.example.project.vo.model;

import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * description: 返回模型
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {

    private Boolean success;
    private int code;
    private String msg;
    private T data;

    public static <T>Result<T> success(T data) {
        return new Result(true,200,  "success", data);
    }
    public static <T>Result<T> success() {
        return new Result(true,200,  "success", null);
    }


    public static <T>Result<T>  fail(String msg) {
        return new Result(false,500, msg, null);
    }

    public static <T>Result<T>  fail( Integer code,String msg) {
        return new Result(false,code, msg, null);
    }

}